package cn.dujc.superkid.fragment.cup;

import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;

import java.util.ArrayList;
import java.util.List;

import cn.dujc.core.ui.BaseFragment;
import cn.dujc.superkid.R;
import cn.dujc.superkid.adapter.VideoChapterAdapter;
import cn.dujc.superkid.adapter.cup.CupChapterAdapter;
import cn.dujc.superkid.bean.CupListResult;
import cn.dujc.superkid.bean.VideoListResult;
import cn.dujc.superkid.fragment.MyLessonVideo.*;

/**
 * Created by Administrator on 2018/10/17 0017.
 */

public class CupChapterFragment extends BaseFragment {
    private List<CupListResult.VideoBean> mList = new ArrayList<>();
    private CupChapterAdapter mAdapter;
    private RecyclerView recyclerView_chapter;
    private final String TAG = cn.dujc.superkid.fragment.MyLessonVideo.ChapterFragment.class.getName();
    private String video_id;
    private String course_id;
    @Override
    public int getViewId() {
        return R.layout.fragment_chapter;
    }

    @Override
    public void initBasic(Bundle savedInstanceState) {


        Bundle bundle1 = getArguments();
        if(bundle1 != null){
            video_id = bundle1.getString("video_id");
            mList = bundle1.getParcelableArrayList("list2");
            course_id=bundle1.getString("course_id");
            recyclerView_chapter = (RecyclerView) findViewById(R.id.chapter_recyclerview);
            mAdapter = new CupChapterAdapter(mList,getContext(),video_id,course_id);
            recyclerView_chapter.setAdapter(mAdapter);
//            ToastUtil.showToast(getContext(), "选中了第二个");
            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.getActivity());
            linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
            recyclerView_chapter.setLayoutManager(linearLayoutManager);
            //分割线
            recyclerView_chapter.addItemDecoration(new DividerItemDecoration(this.getActivity(), linearLayoutManager.getOrientation()));

        }

    }
}
